#!/bin/bash

function show_cache_buffer_info()
{
    free -m
    grep -E 'Buffers|Cached' /proc/meminfo
}

sync; echo 3 > /proc/sys/vm/drop_caches
show_cache_buffer_info
dd if=/dev/zero of=test.img bs=1M count=512
show_cache_buffer_info